

public class ClassMB {
	public String filePath(Entity entity){
		StringBuilder path = new StringBuilder();
		path.append(entity.getWEBPoject());
		path.append(entity.getSeparator());
		path.append("mb");
		path.append(entity.getSeparator());
		path.append("MB");
		path.append(entity.getClassName());
		path.append(".java");
		
		return path.toString();
	}
	
	public String sourceCode(Entity entity) {
		StringBuilder classBuilder = new StringBuilder();
		classBuilder.append("package ").append(entity.getBasePackage()).append(".mb;");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append("import java.io.Serializable;");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append("import javax.ejb.EJB;");
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append("import javax.faces.bean.ManagedBean;");
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append("import javax.faces.bean.ViewScoped;");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("import br.com.bs.fw.mb.MBGeneric;");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("import ").append(entity.getBasePackage()).append(".business.iface.I").append(entity.getClassName()).append("BO;");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("import ").append(entity.getBasePackage()).append(".entity.").append(entity.getClassName()).append(";");
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append("import ").append(entity.getBasePackage()).append(".wrapper.").append(entity.getClassName()).append("Wrapper;");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("@ManagedBean(name=\"mb").append(entity.getClassName()).append("\")");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("@ViewScoped");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("public class MB").append(entity.getClassName()).append(" extends MBGeneric<");
		classBuilder.append(entity.getClassName()).append(", I");
		classBuilder.append(entity.getClassName()).append("BO> implements Serializable {");
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\tprivate static final long serialVersionUID = 1L;");
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\t@EJB");		
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\tprivate I").append(entity.getClassName()).append("BO ").append(entity.getObjectName()).append("BO;");
		classBuilder.append(System.getProperty("line.separator"));		
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\tpublic void init() {");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\t\tthis.setWrapper(new ").append(entity.getClassName()).append("Wrapper());");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\t\tsetBo(").append(entity.getObjectName()).append("BO);");
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("\t}");	
		classBuilder.append(System.getProperty("line.separator"));
		classBuilder.append("}");
		
		return classBuilder.toString();
	}


}